package managedbean;

import javax.faces.context.FacesContext;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import modelo.Users;

public class datos {
    
    Users u = new Users();
    String login;
    
    public datos() {
        super();
        bajardesesion();
    }
    FacesContext ctx = FacesContext.getCurrentInstance();
            HttpServletRequest req = (HttpServletRequest)ctx.getExternalContext().getRequest();
            HttpSession session = req.getSession(true); 
    void bajardesesion(){
            
                //u = (Users)session.getAttribute("usuario");
                String hola=(String)session.getAttribute("saludo");
                
        login = hola;//u.getLogin();
        //System.out.println(login);
        
        
        
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getLogin() {
        return login;
    }

    public String atras() {
        // Add event code here...
        /*FacesContext ctx = FacesContext.getCurrentInstance();
                HttpServletRequest req = (HttpServletRequest)ctx.getExternalContext().getRequest();
                HttpSession session = req.getSession(true);*/
        session.removeAttribute("saludo");//.setAttribute("saludo", null);
        
        return "a_login";
    }
}
